package com.platform.base.service.impl;

import java.util.Arrays;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.platform.base.domain.MeterAnalysis;
import com.platform.base.mapper.MeterAnalysisMapper;
import com.platform.base.service.IMeterAnalysisService;
import com.platform.common.core.text.Convert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * 热解析Service业务层处理
 * 
 * @author wangqi
 * @date 2021-04-25
 */
@Service
public class MeterAnalysisServiceImpl extends ServiceImpl<MeterAnalysisMapper, MeterAnalysis> implements IMeterAnalysisService
{
    @Autowired
    private MeterAnalysisMapper meterAnalysisMapper;


    /**
     * 根据id查询
     * @param id
     * @return
     */
    @Override
    public MeterAnalysis selectMeterAnalysisById(Long id){
        return this.meterAnalysisMapper.selectOne(new QueryWrapper<MeterAnalysis>().eq("id",id));
    }


    /**
     * 查询热解析
     * 
     * @param id 热解析ID
     * @return 热解析
     */
    @Override
    public List<MeterAnalysis> selectMeterAnalysisByTypeId(Long id)
    {
        return meterAnalysisMapper.selectMeterAnalysisByTypeId(id);
    }

    /**
     * 查询热解析列表
     * 
     * @param meterAnalysis 热解析
     * @return 热解析
     */
    @Override
    public List<MeterAnalysis> selectMeterAnalysisList(MeterAnalysis meterAnalysis)
    {
        return meterAnalysisMapper.selectMeterAnalysisList(meterAnalysis);
    }

    /**
     * 新增热解析
     * 
     * @param meterAnalysis 热解析
     * @return 结果
     */
    @Override
    public int insertMeterAnalysis(MeterAnalysis meterAnalysis)
    {
        return meterAnalysisMapper.insert(meterAnalysis);
    }

    /**
     * 修改热解析
     * 
     * @param meterAnalysis 热解析
     * @return 结果
     */
    @Override
    public int updateMeterAnalysis(MeterAnalysis meterAnalysis)
    {
        return meterAnalysisMapper.updateById(meterAnalysis);
    }

    /**
     * 删除热解析对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteMeterAnalysisByIds(String ids)
    {
        return meterAnalysisMapper.deleteBatchIds(Arrays.asList(Convert.toStrArray(ids)));
    }

    /**
     * 删除热解析信息
     * 
     * @param id 热解析ID
     * @return 结果
     */
    @Override
    public int deleteMeterAnalysisById(Long id)
    {
        return meterAnalysisMapper.deleteById(id);
    }
}
